using System.Web;
using CBL;

//using ChannelVN.Kenh14.Business;

namespace ChannelVN.Cached.Common
{
    public class QueryStrings
    {
        #region QueryString value for cached

        public static string CachedZone
        {
            get { return RequestExtensionProperties.CatUrl; }
        }
        public static long CachedTagId
        {
            get
            {
                return string.IsNullOrEmpty(RequestExtensionProperties.TagUrl)
                ? RequestExtensionProperties.TagId
                : RequestExtensionProperties.TagUrl.GetHashCode();
            }
        }
        public static long CachedNewsId
        {
            get { return RequestExtensionProperties.NewsId; }
        }
        public static int CachedPageIndex
        {
            get
            {
                return RequestExtensionProperties.IsAjax ? 0 : RequestExtensionProperties.PageIndex;
            }
        }
        public static string CachedViewByDate
        {
            get
            {
                if (string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["seckey"])) return string.Empty;
                return HttpContext.Current.Request.QueryString["Date"];
            }
        }

        public static bool IsCachedUpdating
        {
            get
            {
                if (string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["updatecached"])) return false;
                return HttpContext.Current.Request.QueryString["updatecached"] == "1";
            }
        }
        public static bool IsCachedDeleting
        {
            get
            {
                if (string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["updatecached"])) return false;
                return HttpContext.Current.Request.QueryString["updatecached"] == "2";
            }
        }
        public static string CachedSecurityKey
        {
            get
            {
                if (string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["seckey"])) return string.Empty;
                return HttpContext.Current.Request.QueryString["seckey"];
            }
        }

        #endregion
    }
}
